{extend name="public/base"}
{block name="head"}
<link rel="stylesheet" href="/public/editor/css/editormd.css" />
<script src="/public/editor/examples/js/jquery.min.js"></script>
<script src="/public/editor/editormd.js"></script>
{/block}
{block name="main"}
<div id="main" class="container">
    <form class="form-horizontal " action="./save" method="post">
        <fieldset>
            <legend>文章添加/修改</legend>
            <div class="control-group">
                <label class="control-label" for="title">文章标题</label>
                <div class="controls">
                    <input type="text" class="input-xlarge" id="title" name="title" :value="title" required="required">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="select01">文章分类</label>
                <div class="controls">
                    <select id="select01" name="c_id" :value="c_id" required="required">
                        <option value="">请选择</option>
                        {volist name='category' id='vo'}
                            <option value="{$vo.id}">{:str_repeat('--',$vo.Count-1)}{$vo.c_name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="author">作者</label>
                <div class="controls">
                    <input type="text" class="input-xlarge" id="author" name="author" :value="author" required="required" >
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="source">来源</label>
                <div class="controls">
                    <input type="text" class="input-xlarge" id="source" name="source" :value="source" required="required" >
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="fileInput">文件上传</label>
                <div class="controls">
                    <input class="input-file" id="fileInput" type="file">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="textarea">文章内容</label>
                <div id="test-editormd" class="controls">
                    <textarea name="content" style="display:none;" id="textarea">{{content}}</textarea>
                </div>
            </div>
            <div class="form-actions">
                <button type="submit" class="btn btn-primary">保存修改</button>
                <button type="reset" class="btn">取消</button>
                <input type="hidden" name="id" :value="id" >
            </div>
        </fieldset>
    </form>
</div>
    <script>
        var data ={$content|raw};
        new Vue({
            el:"#main",
            data:data
        })
    </script>
    <script type="text/javascript">
        var testEditor;
        $(function() {
            editormd.methodOne = function() {
                console.log("editormd.methodOne");
            };
            testEditor = editormd("test-editormd", {
                width  : "90%",
                height : 720,
                path   : '/public/editor/lib/'
            });
            editormd.methodOne();
        });
    </script>
{/block}